{include file="Public:header" /}
<link rel="stylesheet" href="__PUBLIC__/Admin/bootstrap-datetimepicker-master/css/bootstrap-datetimepicker.min.css"
      media="screen"/>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改奖品</h5>
                    <div class="ibox-tools" style="margin-top: -6px;">
                        <button onclick="history.go(-1);" class="btn btn-primary"><i class="fa fa-arrow-left"></i> 返回</button>
                    </div>
                </div>
                <div class="ibox-content">
                    <form action="__URL__/editPrize" method="post" id="defaultForm" class="form-horizontal">

                        <!--<div class="form-group">
                            <label class="col-sm-2 control-label">奖品类型</label>
                             <div class="col-sm-6">
                                 <select onchange="isChange(this);" name="prize_type" class="form-control">
                                    <option {if condition="$prize['prize_type'] eq 1"}selected{/if} value="1">现金抵用券</option>
                                    <option {if condition="$prize['prize_type'] eq 2"}selected{/if} value="2">实物</option>
                                    <option {if condition="$prize['prize_type'] eq 4"}selected{/if} value="4">商品类型兑换券</option>
                                    <option {if condition="$prize['prize_type'] eq 3"}selected{/if} value="3">谢谢参与</option>
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>-->


                        <!--{if condition="$prize['prize_type'] eq 4"}
                        <div class="form-group goodstype">
                            <label class="col-sm-2 control-label">商品类型</label>
                            <div class="col-sm-6">
                                <select name="cat_id" class="form-control" id="typelist">

                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed goodstype"></div>
                        {/if}-->


                        <!--<div id="goodstype" class="form-group goodstype" style="display: none;">
                            <label class="col-sm-2 control-label">商品类型</label>
                            <div class="col-sm-6">
                                <select name="cat_id" class="form-control" id="typelist">

                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed goodstype" style="display: none;"></div>-->


                        <!--<div class="form-group type_momey">
                            <label class="col-sm-2 control-label">价值</label>
                            <div class="col-sm-6">
                                <input type="text" value="{$prize['type_momey']}" name="type_momey" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed type_momey"></div>

                        <div class="form-group min_goods_amount">
                            <label class="col-sm-2 control-label">使用商品最低金额</label>
                            <div class="col-sm-6">
                                <input type="text" value="{$prize['min_goods_amount']}" name="min_goods_amount" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed min_goods_amount"></div>-->

                        <div class="form-group">
                            <label class="col-sm-2 control-label">奖品名称</label>
                            <div class="col-sm-6">
                                <input type="text" value="{$prize['prize_name']}" name="prize_name"
                                       class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <!--<div <?php if($prize['prize_type'] == 1) echo 'style="display:none;"' ?> class="form-group goods_sn_html">
                            <label class="col-sm-2 control-label">实物货号</label>
                            <div class="col-sm-6">
                                <input type="text" value="{$prize['goods_sn']}" name="goods_sn" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed goods_sn_html"></div>-->

                        <div class="form-group">
                            <label class="col-sm-2 control-label">奖品数量</label>
                            <div class="col-sm-6">
                                <input type="text" value="{$prize['prize_num']}" name="prize_num" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label">剩余数量</label>
                            <div class="col-sm-6">
                                <input type="text" value="{$prize['surplus_num']}" name="surplus_num"
                                       class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>


                        <!--<div class="form-group">
                            <label class="col-sm-2 control-label">奖品描述</label>
                             <div class="col-sm-6">
                                <input type="text" value="{$prize['prize_describe']}" name="prize_describe" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>-->

                        <!--<div class="form-group">
                            <label class="col-sm-2 control-label">中奖概率</label>
                            <div class="col-sm-6">
                               <input type="text" value="{$prize['rate']}" name="rate" readonly class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>-->

                        <!--<div class="form-group form-inline bonus-time" >
                            <label class="col-sm-2 control-label">红包有效期</label>
                            <div class="col-sm-8">
                                <div class="col-sm-4 input-group date" id="datetimepicker6">
                                    <input type="text" name="use_start_date" class="form-control" value="{$prize['use_start_date']|date='Y-m-d H:i:s',###}">
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                    <span class="input-group-addon">
                                        <span class="fa fa-calendar"></span>
                                    </span>
                                </div>

                                <div class="col-sm-4 input-group date" id="datetimepicker7">
                                    <input type="text" name="use_end_date" class="form-control" value="{$prize['use_end_date']|date='Y-m-d H:i:s',###}">
                                    <span class="input-group-addon"><span class="glyphicon glyphicon-remove"></span></span>
                                    <span class="input-group-addon">
                                        <span class="fa fa-calendar"></span>
                                    </span>
                                </div>
                                <span class-"help-block">必填</span>
                            </div>
                        </div>
                        <div class="hr-line-dashed bonus-time"></div>-->

                        <!--<div class="form-group is_shipping">
                            <label class="col-sm-2 control-label">是否包邮</label>
                            <div class="i-check col-sm-6">
                                <input type="radio" name="is_shipping" value="1" {if condition="$prize['is_shipping'] eq 1"} checked="checked" {/if}/>
                                是&nbsp;
                                <input type="radio" name="is_shipping" {if condition="$prize['is_shipping'] eq 0"} checked="checked" {/if} value="0" />
                                否
                            </div>
                        </div>
                        <div class="hr-line-dashed is_shipping"></div>-->

                        <div class="form-group">
                            <label class="col-sm-2 control-label">是否显示</label>
                            <div class="i-check col-sm-6">
                                <input type="radio" name="status" value="1" {if condition="$prize['status'] eq 1" }
                                       checked="checked" {/if}/>
                                显示&nbsp;
                                <input type="radio" name="status" {if condition="$prize['status'] eq 2" }
                                       checked="checked" {/if} value="2" />
                                隐藏
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <!--<div class="form-group">
                           <label class="col-sm-2 control-label">每天最多中奖数量</label>
                           <div class="col-sm-6">
                              <input type="text" value="{$prize['max_winning']}" name="max_winning" class="form-control">
                           </div>
                       </div>
                       <div class="hr-line-dashed"></div>-->

                        <!--<div class="form-group">
                            <label class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-6">
                               <input type="text" value="{$prize['note']}" name="note" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>-->

                        <!--<div class="form-group return_url">
                            <label class="col-sm-2 control-label">链接跳转</label>
                            <div class="col-sm-6">
                               <input type="text" value="{$prize['url']}" name="url" class="form-control">
                            </div>
                        </div>
                        <div class="hr-line-dashed return_url"></div>-->


                        <input type="hidden" name="p_id" value="{$p_id}">
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存</button>
                                <button class="btn btn-white" type="submit">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</div>
{include file="Public:footer" /}
</body>
</html>
<script>
    $(document).ready(function () {
        /*$.ajax({
         url : '__URL__/prizeTypeList',
         type : 'get',
         dataType : 'json',
         success : function(data) {
         if(data.state == 0)
         $('#typelist').append(data.option_list);
         }
         });*/
    });


    /*if ({$prize['prize_type']} == 4) {
     var cat_id = "{$prize['cat_id']}";
     $.ajax({
     url: '__URL__/prizeTypeEdit',
     type: 'get',
     data: {id:cat_id},
     dataType: 'html',
     success: function (data) {
     $('#typelist').append(data);
     }
     });
     }*/


    //window.onload=isChange();
    function isChange(obj) {
        var v = $(obj).val();
        if (v == undefined) {
            v = {$prize['prize_type']};
        }
        //红包
        if (v == 1) {
            $(".goods_sn_html").hide();
            $(".goodstype").hide();
            $(".goodstype").hide();
            $(".is_shipping").hide();
            $(".min_goods_amount").hide();

            //实物
        } else if (v == 2) {
            // alert(12);
            $(".goodstype").hide();
            $(".goods_sn_html").show();
            $(".is_shipping").show();
            $(".min_goods_amount").hide();
        }
        else if (v == 4) {
            $(".goods_sn_html").hide();
            $(".min_goods_amount").show();
            $(".is_shipping").hide();
            //$(".goodstype").show();
            if ({$prize['prize_type']} != 4) {
                $("#goodstype").css('display', 'block');

                $.ajax({
                    url: '__URL__/prizeTypeList',
                    type: 'get',
                    dataType: 'json',
                    success: function (data) {
                        if (data.state == 0)
                            $('#typelist').append(data.option_list);
                    }
                });
            }
            //谢谢参与
        } else {
            $(".goodstype").hide();
            $(".type_momey").hide();
            $(".min_goods_amount").hide();
            $(".goods_sn_html").hide();
            $(".bonus-time").hide();
            $(".is_shipping").hide();
            $(".return_url").hide();
        }
    }
</script>

<script>
    $(document).ready(function () {
        /**
         * 下面是进行插件初始化
         * 你只需传入相应的键值对
         * */
        $('#defaultForm').bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {
                /*输入框不同状态，显示图片的样式*/
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                /*验证*/
                prize_name: {
                    /*键名username和input name值对应*/
                    message: '奖品名称验证失败',
                    validators: {
                        notEmpty: {
                            /*非空提示*/
                            message: '奖品名称不能为空'
                        },
                        stringLength: {
                            /*长度提示*/
                            min: 2,
                            max: 30,
                            message: '奖品名称长度必须在2到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                prize_num: {
                    /*键名username和input name值对应*/
                    message: '奖品数量验证失败',
                    validators: {
                        notEmpty: {
                            /*非空提示*/
                            message: '奖品数量不能为空'
                        },
                        stringLength: {
                            /*长度提示*/
                            min: 1,
                            max: 30,
                            message: '奖品数量长度必须在1到30之间'
                        }/*最后一个没有逗号*/
                    }
                },
                /*max_winning:{/!*键名username和input name值对应*!/
                 message: '每天最多中奖数量验证失败',
                 validators: {
                 notEmpty: {/!*非空提示*!/
                 message: '每天最多中奖数量不能为空'
                 },
                 stringLength: {/!*长度提示*!/
                 min: 1,
                 max: 30,
                 message: '每天最多中奖数量长度必须在1到30之间'
                 }/!*最后一个没有逗号*!/
                 }
                 },
                 min_goods_amount: {/!*键名username和input name值对应*!/
                 message: '使用商品最低金额验证失败',
                 validators: {
                 notEmpty: {/!*非空提示*!/
                 message: '使用商品最低金额不能为空'
                 },
                 stringLength: {/!*长度提示*!/
                 min: 1,
                 max: 30,
                 message: '使用商品最低金额必须在2到30之间'
                 }/!*最后一个没有逗号*!/
                 }
                 },
                 type_momey: {/!*键名username和input name值对应*!/
                 message: '实物劵价值验证失败',
                 validators: {
                 notEmpty: {/!*非空提示*!/
                 message: '实物劵价值不能为空'
                 },
                 stringLength: {/!*长度提示*!/
                 min: 1,
                 max: 30,
                 message: '实物劵价值必须在1到30之间'
                 }/!*最后一个没有逗号*!/
                 }
                 },
                 goods_sn: {/!*键名username和input name值对应*!/
                 message: '实物货号验证失败',
                 validators: {
                 notEmpty: {/!*非空提示*!/
                 message: '实物货号不能为空'
                 },
                 stringLength: {/!*长度提示*!/
                 min: 2,
                 max: 30,
                 message: '实物货号必须在2到30之间'
                 }/!*最后一个没有逗号*!/
                 }
                 },
                 voucher_name: {/!*键名username和input name值对应*!/
                 message: '券名验证失败',
                 validators: {
                 notEmpty: {/!*非空提示*!/
                 message: '券名不能为空'
                 },
                 stringLength: {/!*长度提示*!/
                 min: 2,
                 max: 30,
                 message: '券名必须在2到30之间'
                 }/!*最后一个没有逗号*!/
                 }
                 },
                 surplus_num:{/!*键名username和input name值对应*!/
                 message: '剩余数量验证失败',
                 validators: {
                 notEmpty: {/!*非空提示*!/
                 message: '剩余数量不能为空'
                 },
                 stringLength: {/!*长度提示*!/
                 min: 1,
                 max: 30,
                 message: '剩余数量必须在1到30之间'
                 }/!*最后一个没有逗号*!/
                 }
                 }*/
            }
        });

    });
</script>
<script type="text/javascript" src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/bootstrap-datetimepicker.js"
        charset="UTF-8"></script>
<script type="text/javascript"
        src="__PUBLIC__/Admin/bootstrap-datetimepicker-master/js/locales/bootstrap-datetimepicker.zh-CN.js"
        charset="UTF-8"></script>
<script type="text/javascript">
    $('#datetimepicker6').datetimepicker({
        language: 'zh-CN',
        format: 'yyyy-mm-dd hh:ii',
        autoclose: true//日期选择完成后是否关闭选择框
    });
    $('#datetimepicker7').datetimepicker({
        language: 'zh-CN',
        format: 'yyyy-mm-dd hh:ii',
        autoclose: true //Important! See issue #1075
    });
</script>